The present invention relates to video compression and in particular to methods of deblocking compressed video.
Digital video sequences are composed of frames of pixels, where the characteristics of the pixels are represented using digital information. The amount of data that is required to represent a video sequence can be reduced using compression. Several compression schemes seek to utilize characteristics that commonly occur within video sequences to achieve significant reductions in the amount of digital data required to encode a video sequence.
Encoding schemes, such as the scheme described in the MPEG-4 standard, can include video compression algorithms that divide frames into blocks of pixels and use the characteristics of the pixels within the blocks to encode the blocks of the video frame. Treating adjacent blocks separately in a lossy compression scheme can result in artifacts at block boundaries when an encoded video frame is reconstructed. A technique that can be used to remove artifacts and improve the quality of a reconstructed image involves applying a deblocking filter to pixels adjacent block boundaries.
The MPEG-4 standard developed by the Motion Picture Experts Group (i.e. ISO/IEC 14496) contains an example of a deblocking filter that can be applied when reconstructing video encoded using an MPEG-4 compliant encoder. The disclosure of the MPEG-4 standard is incorporated herein by reference in its entirety. The filtering is typically performed by a decoder and the filter is applied along the edges of the 8×8 blocks of pixels that were used in the encoding of the video frame. In many instances, the deblocking filter is applied to both luminance and chrominance data.
The deblocking filter specified in the MPEG-4 standard can operate in one of two modes. The modes are commonly referred to as the “DC offset mode” and “the default mode”. The pixel conditions around each block boundary determine which mode to use. The “DC offset mode” is typically selected to filter block boundaries that are located within very smooth regions of a video frame (i.e. a region without much detail). The default mode is typically selected for all other cases. The term “smooth” describes a region of a video frame where the chrominance and luminance either do not vary or vary gradually across adjacent pixels. The term “detail” is typically used to describe visual elements of a video frame that vary significantly across adjacent pixels. The appearance of a reconstructed image usually can be improved by applying a filter that smoothes variation across block boundaries that lie in smooth regions of the image. However, smoothing a block boundary that lies in a region possessing a high level of detail can actually detract from the appearance of the reconstructed frame.
The decoding process specified in the MPEG-4 standard involves applying the MPEG-4 deblocking filter to each row of pixels at vertical block boundaries and each column of pixels at horizontal block boundaries. The application of the deblocking filter in relation to each row or column of pixels involves a decision concerning which filter mode is most appropriate. In order to determine the filtering mode to use, the decoder inspects five pixels of the row or column on either side of the block boundary. The following filter mode decision algorithm is then applied using the chrominance or luminance values of ten pixels v0-v9:eq—cnt=φ(v0-v1)+φ(v1-v2)+φ(v2-v3)+φ(v3-v4)+φ(v4-v5)+φ(v5-v6)+φ(v6-v7)+φ(v7-v8)+φ(v8-v9),
where φ(γ)=1 if |γ|≦THR1 and 0 otherwise.
If (eq_cnt≧THR2)                DC offset mode is applied,        
else                Default mode is applied.        
The threshold values THR1 and THR2 can be determined based upon the desired quality of the visual image. Suitable values for the thresholds are THR1=2 and THR2=6.
The “DC offset mode” of the deblocking filter is specified in the MPEG-4 standard and is intended to reduce blocking artifacts due to dc offset in very smooth regions of an image. The filter that is applied to the chrominance or luminance values of the four pixels on either side of a block boundary (i.e. v1-v8) in “DC offset mode” as follows:
 max = MAX ( v1 , v2, v3, v4, v5, v6, v7, v8),min = MIN (v1, v2, v3, v4, v5, v6, v7, v8),if ( |max−min| < 2·QP ) {                        v        n        ′            =                        ∑                      k            =                          -              4                                4                ⁢                                  ⁢                              b            k                    ·                      p                          n              +              k                                            ,                  1        ≤        n        ≤                  8          ⁢                                          ⁢                      p            m                              =              {                                                                                                                                                (                                                                                                                                                                        v                                1                                                            -                                                              v                                0                                                                                                                                          <                          QP                                                )                                            ?                                                                        v                          0                                                :                                                  v                          1                                                                                      ,                                                                                                            ⁢                                                                  if                        ⁢                                                                                                  ⁢                        m                                            <                      1                                                                                                                                                                                      v                        m                                            ,                                        ⁢                                                                                                                                                                          ⁢                                                                  if                        ⁢                                                                                                  ⁢                        1                                            ≤                      m                      ≤                      8                                                                                                                                        (                                                                                                                                                                                v                              8                                                        -                                                          v                              9                                                                                                                                <                                                  QP                          ?                                                                                    v                              9                                                        :                                                          v                              8                                                                                                                          ,                                                                                                                                ⁢                                                                  if                        ⁢                                                                                                  ⁢                        m                                            >                      8                                                                                            ⁢                                                  ⁢                          {                                                b                  k                                :                                                      -                    4                                    ≤                  k                  ≤                  4                                            }                                =                                    {                              1                ,                1                ,                2                ,                2                ,                4                ,                2                ,                2                ,                1                ,                1                            }                        //            16                              }else No change will be done.
where                QP is the average of the quantizers used in the encoding of the two blocks        
The “default mode” of the deblocking filter is also specified in the MPEG-4 standard and involves replacing the two pixels adjacent the block boundary (i.e. v4 and v5) as follows:v4′=v4−d, v5′=v5+d, andd=CLIP(5·(a3,0′-a3,0)//8,0,(v4-v5)/2)·δ(|a3,0|<QP)
where a3,0′=SIGN(a3,0)·MIN(|a3,0|, |a3,1|, |a3,2|).
Frequency components a3,0, a3,1, and a3,2 can be evaluated from the simple inner product of the approximated DCT kernel [2 −5 5 −2] with the pixel vectors as follows:a3,0=([2 −5 5 −2]·[v3v4v5v6]T)//8,a3,1=([2 −5 5 −2]·[v1v2v2v4]T)//8,a3,2=([2 −5 5 −2]·[v5v6v7v8]T)//8.
The algorithm used in the “default mode” of the deblocking filter described in the MPEG-4 standard can involve complex calculations including 4-tap filtering and clipping.